<template>
  <view>
    <nav-bar title="初期评定结果"></nav-bar>
    <view class="plan-form">
      <scroll-view scroll-y :style="{ height: formHeight }">
        <view class="form-box" v-if="showForm">
          <you-form
            ref="form"
            formTitle="我的评估报告"
            :formConfig="assessConfig"
            v-model="assessData"
          ></you-form>
        </view>
      </scroll-view>
    </view>
  </view>
</template>

<script>
  import { ASSESS_CONFIG } from '../physicianTrainPlan/formConfig/planConfig.js'
  import api_user from '@/api/user'
  export default {
    name: 'MyAssess',
    data() {
      return {
        formHeight: '',
        planId: null,
        assessConfig: [],
        assessData: {},
        showForm: false
      }
    },
    onLoad(options) {
      this.formHeight = this.$store.getters.heightData.noTabMainHeight - 10 + 'px'
      this.assessConfig = uni.$u.deepClone(ASSESS_CONFIG)
      this.assessConfig.forEach(item => {
        item.isDisabled = true
      })
      this.planId = options.planId
      this.getAssessData()
    },
    methods: {
      getAssessData() {
        const params = {
          planId: this.planId
        }
        api_user.reportDetail(params).then(res => {
          if (res.code !== 200) return
          this.assessData = res.data
          this.showForm = true
        })
      }
    }
  }
</script>
<style lang="scss">
  .plan-form {
    padding-top: 15px;
  }
  .form-box {
    margin: 0 30rpx;
    border-radius: 16rpx;
    background-color: #FFF;
    overflow: hidden;
  }
  .content {
    margin-bottom: 50rpx;
    text-align: center;
  }
  .popup-btn {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 88rpx;
    border-top: 2rpx solid #e5e5e5;
    .cancel,
    .edit {
      width: 100%;
      height: 100%;
      line-height: 88rpx;
    }
    .edit {
      border-left: 2rpx solid #e5e5e5;
      color: #115BAA;
    }
  }
</style>
